home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / vsoup11.zip / areas.hh < prev    next >
Text File  |  1996-08-01  |  3KB  |  87 lines

  1. //  $Id: areas.hh 1.6 1996/08/01 12:10:13 hardy Exp $
  2. //
  3. //  This progam/module was written by Hardy Griech based on ideas and
  4. //  pieces of code from Chin Huang (cthuang@io.org).  Bug reports should
  5. //  be submitted to rgriech@ibm.net.
  6. //
  7. //  This file is part of soup++ for OS/2.  Soup++ including this file
  8. //  is freeware.  There is no warranty of any kind implied.  The terms
  9. //  of the GNU Gernal Public Licence are valid for this piece of software.
  10. //
  11.  
  12.  
  13. #ifndef __AREAS_HH__
  14. #define __AREAS_HH__
  15.  
  16.  
  17. #include <stdio.h>
  18.  
  19. #include "sema.hh"
  20.  
  21.  
  22. class TAreas {
  23.  
  24. private:
  25.     TAreas( const TAreas &right );      // copy constructor not allowed !
  26.     operator = (const TAreas &right);   // assignment operator not allowed !
  27.     TAreas( void );                     // not allowed !
  28. public:
  29.     TAreas( const char *areasName, const char *msgNamePattern );
  30.     ~TAreas();
  31.  
  32.     void msgOpen( const char *id, const char *format );
  33.     void msgClose( void );
  34.     int  msgPuts( const char *s );
  35.     size_t msgWrite( const char *buf, size_t size, size_t count );
  36.     int  msgPrintf( const char *fmt, ... );
  37.     void msgFlush( void );
  38.     void closeAll( void );
  39.     void msgStart( void );    // for multithreading (zwar ein Krüppel, aber doch)
  40.                               // msgOpon is not required (also msgClose), see next version...
  41.     void msgStop( void );     // for multithreading
  42.  
  43. protected:
  44.     const char *msgNamePattern;
  45.     FILE *areasF;
  46.  
  47. private:
  48.     const char *areasName;          // zwischengespeicherte Parameter
  49.     const char *msgId;
  50.     const char *msgFormat;
  51.     FILE *msgF;
  52.     int  msgCounter;
  53.     const char *msgName;
  54.     int  msgStarted;
  55.  
  56.     void msgEffOpen( void );
  57.     void areasClose( void );
  58. };
  59.     
  60.  
  61. class TAreasMail: public TAreas  {
  62. private:
  63.     TAreasMail( void );                         // not allowed !
  64.     TAreasMail( const TAreasMail &right );      // copy constructor not allowed !
  65.     operator = (const TAreasMail &right);       // assignment operator not allowed !
  66. public:
  67.     TAreasMail( const char *areasName, const char *msgNamePattern ); ///: TAreas(areasName,msgNamePattern) {}
  68.     ~TAreasMail();
  69.     void mailStart( int doEcho=0 );
  70.     void mailStop( void );
  71.     int  mailPrintf( const char *fmt, ... );
  72.     int  mailPrintf1( int doEcho, const char *fmt, ... );
  73.     void closeAll( int genStsMail, const char *msg = NULL );
  74. private:
  75.     int mailStarted;
  76.     int mailFirstLine;
  77.     FILE *mailF;
  78.     const char *mailName;
  79.     int conEcho;
  80.     TSemaphor mpSema;
  81.  
  82.     void mailEffOpen( void );
  83. };
  84.  
  85.  
  86. #endif   // __AREAS_HH__
  87.